

	/*-----------------------
		TABLES TEX
	------------------------*/

			*** Covid
				*** Mitigation table
				
			use "$root/dat/SN_2020_Covid19.dta", clear
			drop if consent==0
			drop if pilot==1

			* svyset declares the post-stratifcation design using true regional weight as share. 
				svyset _n [pw=weight_adult], poststrata(mi01) postweight(region_share)
				
			*** Share of population (\%)
			tab location, gen(loc)
			tab educ, gen(ed)
			
			local sh1=100
			svy: mean ls02
			local sh2=_b[ls02]*100
			local sh3=100-`sh2'
			svy: mean dakar
			local sh4=_b[dakar]*100
			local sh5=100-`sh4'
			svy: mean loc1
			local sh6=_b[loc1]*100
			svy: mean loc2
			local sh7=_b[loc2]*100
			svy: mean loc3
			local sh8=_b[loc3]*100
			svy: mean ed1
			local sh9=_b[ed1]*100
			svy: mean ed2
			local sh10=_b[ed2]*100
			svy: mean ed3
			local sh11=_b[ed3]*100
			svy: mean pov_1_90
			local sh12=_b[pov_1_90]*100
			local sh13=100-`sh12'
		
					forvalue i=1/9 {
					replace mg0`i'=mg0`i'*100
					}
				
				*National
				forvalue i=1/9 {
				qui svy: mean mg0`i'
				local x1_mg`i'=_b[mg0`i']
				local se1_mg`i'=_se[mg0`i']
				}
				
				*Gender
				forvalue i=1/9 {
				qui svy: mean mg0`i' if ls02==1
				local x2_mg`i'=_b[mg0`i']
				local se2_mg`i'=_se[mg0`i']
				}
				
				forvalue i=1/9 {
				qui svy: mean mg0`i' if ls02==0
				local x3_mg`i'=_b[mg0`i']
				local se3_mg`i'=_se[mg0`i']
				}
				
				*Dakar
				forvalue i=1/9 {
				qui svy: mean mg0`i' if dakar==1
				local x4_mg`i'=_b[mg0`i']
				local se4_mg`i'=_se[mg0`i']
				}
				
				forvalue i=1/9 {
				qui svy: mean mg0`i' if dakar==0
				local x5_mg`i'=_b[mg0`i']
				local se5_mg`i'=_se[mg0`i']
				}
				
				*Location
				forvalue i=1/9 {
				qui svy: mean mg0`i' if location==1
				local x6_mg`i'=_b[mg0`i']
				local se6_mg`i'=_se[mg0`i']
				}
				
				forvalue i=1/9 {
				qui svy: mean mg0`i' if location==2
				local x7_mg`i'=_b[mg0`i']
				local se7_mg`i'=_se[mg0`i']
				}
				
				forvalue i=1/9 {
				qui svy: mean mg0`i' if location==3
				local x8_mg`i'=_b[mg0`i']
				local se8_mg`i'=_se[mg0`i']
				}
				
				*Education
				forvalue i=1/9 {
				qui svy: mean mg0`i' if educ==1
				local x9_mg`i'=_b[mg0`i']
				local se9_mg`i'=_se[mg0`i']
				}
				
				forvalue i=1/9 {
				qui svy: mean mg0`i' if educ==2
				local x10_mg`i'=_b[mg0`i']
				local se10_mg`i'=_se[mg0`i']
				}
				
				forvalue i=1/9 {
				qui svy: mean mg0`i' if educ==3
				local x11_mg`i'=_b[mg0`i']
				local se11_mg`i'=_se[mg0`i']
				}
				
				*Poverty
				forvalue i=1/9 {
				qui svy: mean mg0`i' if pov_1_90==1
				local x12_mg`i'=_b[mg0`i']
				local se12_mg`i'=_se[mg0`i']
				}
				
				forvalue i=1/9 {
				qui svy: mean mg0`i' if pov_1_90==0
				local x13_mg`i'=_b[mg0`i']
				local se13_mg`i'=_se[mg0`i']
				}
				

				clear
				set obs 13
				forvalue i=1/21{
				gen var`i'=""
				}
				
					forvalue j=1/13 {
				local k=1
				forvalue i=1(2)17{
				replace var`i' = "`x`j'_mg`k''" if _n==`j'
				local k=`k'+1
					}
				}
				
					forvalue j=1/13 {
				local k=1
				forvalue i=2(2)18{
				replace var`i' = "`se`j'_mg`k''" if _n==`j'
				local k=`k'+1
					}
				}
			
				sxpose, clear
								
				local k=1
				forvalue i=1/13{
				replace _var`i' = "`sh`k''" if _n==19
				local k=`k'+1			
				}
				
				gen var=""
				replace var= "Last week, did you wash your hands \\ with soap more often than used to?" if _n==1
				replace var= "Last week, did you \\ avoid handshakes \\ physical greetings?" if _n==3
				replace var="Last week,  did you \\ wear face masks?"  if _n==5
				replace var= "Last week, did you \\ reduce the number of \\ visits to friends or relatives?" if _n==7
				replace var= "Last week, did you \\ work  less \\ outside of home?" if _n==9
				replace var= "Last week, did you \\ or your family isolate \\ yourself from others?" if _n==11
				replace var= "Last week, did you reduce \\ the number of times you go to \\ the market/grocery store?" if _n==13
				replace var= "Last week, did you \\ stop  going to \\ church/mosque?" if _n==15
				replace var= "Last week, did you avoid \\ groups of more than 10 people \\ such as parties, funerals, etc?" if _n==17
				replace var= "Share of population (\%)" if _n==19				

				order var
				ren _var* var*
				
				forvalue i=1/13{
					replace var`i'=substr(var`i',1,4)
				}
				
				foreach v of varlist var1-var13{
				forvalue j=2(2)18 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
				texsave v* using "$root\tex\mitigation.tex", nonames replace frag  headerlines("& Nati-onal & Female & Male & ~~Dakar & ROS & Reg. capital & Other town & Village & No education & Prim-ary & Secon-dary+ & Poor & Not poor") nofix landscape title ("Mitigation measures") footlines("") footnote ("Standard errors in parentheses.")
	
/*------------------------------------------------------------------------------------*/	
	
					*** Contact table
					use "$root/dat/SN_2020_Covid19.dta", clear
					drop if consent==0
					drop if pilot==1
	
					* svyset declares the post-stratifcation design using true regional weight as share. 
						svyset _n [pw=weight_adult], poststrata(mi01) postweight(region_share)	
					
				tab em03, gen(contact)
				ren mg10 contact5
			
			*** Share of population (\%)
			tab location, gen(loc)
			tab educ, gen(ed)
			
			local sh1=100
			svy: mean ls02
			local sh2=_b[ls02]*100
			local sh3=100-`sh2'
			svy: mean dakar
			local sh4=_b[dakar]*100
			local sh5=100-`sh4'
			svy: mean loc1
			local sh6=_b[loc1]*100
			svy: mean loc2
			local sh7=_b[loc2]*100
			svy: mean loc3
			local sh8=_b[loc3]*100
			svy: mean ed1
			local sh9=_b[ed1]*100
			svy: mean ed2
			local sh10=_b[ed2]*100
			svy: mean ed3
			local sh11=_b[ed3]*100
			svy: mean pov_1_90
			local sh12=_b[pov_1_90]*100
			local sh13=100-`sh12'

				forvalue i=1/4 {
				replace contact`i'=contact`i'*100
				}
				
				*National
				forvalue i=1/5 {
				qui svy: mean contact`i'
				local x1_mg`i'=_b[contact`i']
				local se1_mg`i'=_se[contact`i']
				}
				
				*Gender
				forvalue i=1/5 {
				qui svy: mean contact`i' if ls02==1
				local x2_mg`i'=_b[contact`i']
				local se2_mg`i'=_se[contact`i']
				}
				
				forvalue i=1/5 {
				qui svy: mean contact`i' if ls02==0
				local x3_mg`i'=_b[contact`i']
				local se3_mg`i'=_se[contact`i']
				}
				
				*Dakar
				forvalue i=1/5 {
				qui svy: mean contact`i' if dakar==1
				local x4_mg`i'=_b[contact`i']
				local se4_mg`i'=_se[contact`i']
				}
				
				forvalue i=1/5 {
				qui svy: mean contact`i' if dakar==0
				local x5_mg`i'=_b[contact`i']
				local se5_mg`i'=_se[contact`i']
				}
				
				*Location
				forvalue i=1/5 {
				qui svy: mean contact`i' if location==1
				local x6_mg`i'=_b[contact`i']
				local se6_mg`i'=_se[contact`i']
				}
				
				forvalue i=1/5 {
				qui svy: mean contact`i' if location==2
				local x7_mg`i'=_b[contact`i']
				local se7_mg`i'=_se[contact`i']
				}
				
				forvalue i=1/5 {
				qui svy: mean contact`i' if location==3
				local x8_mg`i'=_b[contact`i']
				local se8_mg`i'=_se[contact`i']
				}
				
				*Education
				forvalue i=1/5 {
				qui svy: mean contact`i' if educ==1
				local x9_mg`i'=_b[contact`i']
				local se9_mg`i'=_se[contact`i']
				}
				
				forvalue i=1/5 {
				qui svy: mean contact`i' if educ==2
				local x10_mg`i'=_b[contact`i']
				local se10_mg`i'=_se[contact`i']
				}
				
				forvalue i=1/5 {
				qui svy: mean contact`i' if educ==3
				local x11_mg`i'=_b[contact`i']
				local se11_mg`i'=_se[contact`i']
				}
				
				*Poverty
				forvalue i=1/5 {
				qui svy: mean contact`i' if pov_1_90==1
				local x12_mg`i'=_b[contact`i']
				local se12_mg`i'=_se[contact`i']
				}
				
				forvalue i=1/5 {
				qui svy: mean contact`i' if pov_1_90==0
				local x13_mg`i'=_b[contact`i']
				local se13_mg`i'=_se[contact`i']
				}
				
				/*Worker
				svy: mean contact5 if em01==1
				local x14_mg5=_b[contact5]
				local se14_mg5=_se[contact5]
				
				svy: mean contact5 if em01==0
				local x15_mg5=_b[contact5]
				local se15_mg5=_se[contact5]*/
				

				clear
				set obs 13
				forvalue i=1/13{
				gen var`i'=""
				}
				
				forvalue j=1/13 {
				local k=1
				forvalue i=1(2)9{
				replace var`i' = "`x`j'_mg`k''" if _n==`j'
				local k=`k'+1
					}
				}
				
				forvalue j=1/13 {
				local k=1
				forvalue i=2(2)10{
				replace var`i' = "`se`j'_mg`k''" if _n==`j'
				local k=`k'+1
					}
				}
			
				gen var=""
				order var
			
				sxpose, clear
								
				local k=1
				forvalue i=1/13{
				replace _var`i' = "`sh`k''" if _n==12
				local k=`k'+1			
				}
				
				gen var=""	
				replace var= "In a typical day of work,\\ how many people do you interact\\ with outside of home?" if _n==1
				replace var= "\hspace{0.5cm} 0 to 4" if _n==2
				replace var= "\hspace{0.5cm} 5 to 9" if _n==4
				replace var= "\hspace{0.5cm} 10 to 50" if _n==6
				replace var= "\hspace{0.5cm} More than 50" if _n==8
				replace var= "How many direct contacts \\ did you have yesterday?" if _n==10
				replace var= "Share of population (\%)" if _n==12				

				order var
				ren _var* var*
				
				forvalue i=1/13{
					replace var`i'=substr(var`i',1,4)
				}
				
				foreach v of varlist var1-var13{
				forvalue j=3(2)11 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}

				texsave v* using "$root\tex\contact.tex", nonames replace frag  headerlines("& Nati-onal & Female & Male & ~~Dakar & ROS & Reg. capital & Other town & Village & No education & Prim-ary & Secon-dary+ & Poor & Not poor") nofix landscape title ("Number of contacts") footlines("") footnote ("Standard errors in parentheses.")
			
			*Graph cumulative number of contacts
				use "$root/dat/SN_2020_Covid19.dta", clear
					drop if consent==0
					drop if pilot==1
					drop if mg10==.
				gen xx=weight_adult*mg10
				total xx
				gen shx=xx/ 11965.14
				sum shx
				gsort -shx
				gen cum_shx=sum(shx)
				total weight_adult
				gen cum_weight=sum(weight_adult/1572.918)
				
				line cum_shx cum_weight, xtitle(Proportion of population) ytitle(Proportion of contacts) xline(.2)
				graph export "$root\tex\cumcontact.pdf", replace
				
				gen top20=(cum_weight<=.2)
				
/*------------------------------------------------------------------------------------*/	
	
					*** Income, food security and employment
					use "$root/dat/SN_2020_Covid19.dta", clear
					drop if consent==0
					drop if pilot==1
	
					* svyset declares the post-stratifcation design using true regional weight as share. 
						svyset _n [pw=weight_hh], poststrata(mi01) postweight(region_share)	
					
			*** Share of population (\%)
			tab location, gen(loc)
			tab educ, gen(ed)
			
			local sh1=100
			qui svy: mean dakar
			local sh2=_b[dakar]*100
			local sh3=100-`sh2'
			qui svy: mean loc1
			local sh4=_b[loc1]*100
			qui svy: mean loc2
			local sh5=_b[loc2]*100
			qui svy: mean loc3
			local sh6=_b[loc3]*100
			qui svy: mean ed1
			local sh7=_b[ed1]*100
			qui svy: mean ed2
			local sh8=_b[ed2]*100
			qui svy: mean ed3
			local sh9=_b[ed3]*100
			qui svy: mean pov_1_90
			local sh10=_b[pov_1_90]*100
			local sh11=100-`sh10'

				tab fs07, gen(inc)
				forvalue i=1/3{
				local j=`i'+5
				ren inc`i' inc`j'
				}
				ren nc04 inc1
				ren em01 inc2
				ren em02 inc3
				ren fs011 inc4
				ren fs012 inc5
				
				forvalue i=1/2 {
				replace inc`i'=inc`i'*100
				}
				
				forvalue i=6/8 {
				replace inc`i'=inc`i'*100
				}
				
				*National
				forvalue i=1/8{
				qui svy: mean inc`i'
				local x1_mg`i'=_b[inc`i']
				local se1_mg`i'=_se[inc`i']
				}
				
				*Dakar
				forvalue i=1/8 {
				qui svy: mean inc`i' if dakar==1
				local x2_mg`i'=_b[inc`i']
				local se2_mg`i'=_se[inc`i']
				}
				
				forvalue i=1/8 {
				qui svy: mean inc`i' if dakar==0
				local x3_mg`i'=_b[inc`i']
				local se3_mg`i'=_se[inc`i']
				}
				
				*Location
				forvalue i=1/8 {
				qui svy: mean inc`i' if location==1
				local x4_mg`i'=_b[inc`i']
				local se4_mg`i'=_se[inc`i']
				}
				
				forvalue i=1/8 {
				qui svy: mean inc`i' if location==2
				local x5_mg`i'=_b[inc`i']
				local se5_mg`i'=_se[inc`i']
				}
				
				forvalue i=1/8 {
				qui svy: mean inc`i' if location==3
				local x6_mg`i'=_b[inc`i']
				local se6_mg`i'=_se[inc`i']
				}
				
				*Education
				forvalue i=1/8 {
				qui svy: mean inc`i' if educ==1
				local x7_mg`i'=_b[inc`i']
				local se7_mg`i'=_se[inc`i']
				}
				
				forvalue i=1/8 {
				qui svy: mean inc`i' if educ==2
				local x8_mg`i'=_b[inc`i']
				local se8_mg`i'=_se[inc`i']
				}
				
				forvalue i=1/8 {
				qui svy: mean inc`i' if educ==3
				local x9_mg`i'=_b[inc`i']
				local se9_mg`i'=_se[inc`i']
				}
				
				*Poverty
				forvalue i=1/8 {
				qui svy: mean inc`i' if pov_1_90==1
				local x10_mg`i'=_b[inc`i']
				local se10_mg`i'=_se[inc`i']
				}
				
				forvalue i=1/8 {
				qui svy: mean inc`i' if pov_1_90==0
				local x11_mg`i'=_b[inc`i']
				local se11_mg`i'=_se[inc`i']
				}
								
				clear
				set obs 11
				forvalue i=1/17{
				gen var`i'=""
				}
				
				forvalue j=1/11 {
				local k=1
				forvalue i=1(2)15{
				replace var`i' = "`x`j'_mg`k''" if _n==`j'
				local k=`k'+1
					}
				}
				
				forvalue j=1/11 {
				local k=1
				forvalue i=2(2)16{
				replace var`i' = "`se`j'_mg`k''" if _n==`j'
				local k=`k'+1
					}
				}
				
				gen var=""
				order var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var
				
				sxpose, clear
								
				local k=1
				forvalue i=1/11{
				replace _var`i' = "`sh`k''" if _n==18
				local k=`k'+1			
				}
				
				gen var=""	
				replace var= "In the past 7 days, my total \\ household income was lower than \\ normal for my household?" if _n==1
				replace var= "Did you spend at least one \\ hour working yesterday?" if _n==3
				replace var= "How many hours did you spend \\ working yesterday?" if _n==5
				replace var= "In the past 7 days, how many days \\ have you or someone in your household had \\ to limit portion size at meal-times?" if _n==7
				replace var= "In the past 7 days, how many days \\ have you or someone in your household had \\ to reduce number of meals eaten in a day?" if _n==9
				replace var= "Compared to last month, \\ did the price of the rice" if _n==11
				replace var= "\hspace{0.5cm} Increase" if _n==12
				replace var= "\hspace{0.5cm} Decrease" if _n==14
				replace var= "\hspace{0.5cm} Stay the same" if _n==16
				replace var= "Share of population (\%)" if _n==18				

				order var
				ren _var* var*
				
				forvalue i=1/11{
					replace var`i'=substr(var`i',1,4)
				}
				
				foreach v of varlist var1-var11{
				forvalue j=2(2)10 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
				foreach v of varlist var1-var11{
				forvalue j=13(2)17 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}

				texsave v* using "$root\tex\income.tex", nonames replace frag  headerlines("& Nati-onal &  ~~Dakar & ROS & Reg. capital & Other town & Village & No education & Prim-ary & Secon-dary+ & Poor & Not poor") nofix landscape title ("Income, employment and food security") footlines("") footnote ("Standard errors in parentheses.")
				
			*** Migration
					use "$root/dat/SN_2020_Covid19.dta", clear
					drop if consent==0
					drop if pilot==1
	
					* svyset declares the post-stratifcation design using true regional weight as share. 
						svyset _n [pw=weight_adult], poststrata(old_reg) postweight(old_region_share)	
						
								*** Share of population (\%)
			tab location2, gen(loc)
			tab educ, gen(ed)
			
			local sh1=100
			svy: mean ls02
			local sh2=_b[ls02]*100
			local sh3=100-`sh2'
			svy: mean ed1
			local sh4=_b[ed1]*100
			svy: mean ed2
			local sh5=_b[ed2]*100
			svy: mean ed3
			local sh6=_b[ed3]*100
			svy: mean pov_1_90
			local sh7=_b[pov_1_90]*100
			local sh8=100-`sh7'

			replace mi03=mi03*100
			
			*National
				qui svy: mean mi03
				local x1_mg1=_b[mi03]
				local se1_mg1=_se[mi03]
	
				*Gender
				qui svy: mean mi03 if ls02==1
				local x2_mg1=_b[mi03]
				local se2_mg1=_se[mi03]
				
				qui svy: mean mi03 if ls02==0
				local x3_mg1=_b[mi03]
				local se3_mg1=_se[mi03]
				
				*Education
				qui svy: mean mi03 if location==1
				local x4_mg1=_b[mi03]
				local se4_mg1=_se[mi03]
				
				qui svy: mean mi03 if location==2
				local x5_mg1=_b[mi03]
				local se5_mg1=_se[mi03]
				
				qui svy: mean mi03 if location==3
				local x6_mg1=_b[mi03]
				local se6_mg1=_se[mi03]
				
				*Poverty
				qui svy: mean mi03 if pov_1_90==1
				local x7_mg1=_b[mi03]
				local se7_mg1=_se[mi03]
				
				qui svy: mean mi03 if pov_1_90==0
				local x8_mg1=_b[mi03]
				local se8_mg1=_se[mi03]
				
				clear
				set obs 8
				forvalue i=1/3{
				gen var`i'=""
				}
				
				forvalue j=1/8 {
				replace var1 = "`x`j'_mg1'" if _n==`j'
				local k=`k'+1
					}
	
				
				forvalue j=1/8 {
				replace var2 = "`se`j'_mg1'" if _n==`j'
					}
			
				sxpose, clear
								
				local k=1
				forvalue i=1/8{
				replace _var`i' = "`sh`k''" if _n==3
				local k=`k'+1			
				}
				
				gen var=""
				replace var= "Were you staying in the \\ same place at the 1st of March?" if _n==1
				replace var= "Share of population (\%)" if _n==3				

				order var
				ren _var* var*
				
				forvalue i=1/8{
					replace var`i'=substr(var`i',1,4)
				}
				
				foreach v of varlist var1-var8{
					replace `v'="("+`v'+")" if _n==2
				}
				
				texsave v* using "$root\tex\migration1.tex", nonames replace frag  headerlines("& National & Female & Male & No education & Primary & Secondary+ & Poor & Not poor") nofix landscape title ("Migration") footlines("") footnote ("Standard errors in parentheses.")
						
			*** Migration by group of region
			use "$root/dat/SN_2020_Covid19.dta", clear
					drop if consent==0
					drop if pilot==1
	
					* svyset declares the post-stratifcation design using true regional weight as share. 
						
						replace mi03=mi03*100
						tab location, gen(loc)

						
						forvalue i=1/6{
						gen r`i'=(reg_group==`i' & reg_group!=.)
						}
						
						svyset _n [pw=weight_adult], poststrata(strata_reg_sex2) postweight(reg_sex_share2)
						
						forvalue i=1/6{
						svy:mean r`i'
						local sh`i'=_b[r]*100
						}
						
						forvalue i=1/3{
						local k=`i'+6
						svy:mean loc`i'
						local sh`k'=_b[loc]*100
						}

						forvalue i=1/6{
						svy:mean mi03 if reg_group==`i' 
						local x`i'=_b[mi03]
						local x_se`i'=_se[mi03]
						}
						
						forvalue i=1/3{
						local k=`i'+6
						svy:mean mi03 if location==`i' 
						local x`k'=_b[mi03]
						local x_se`k'=_se[mi03]
						}
						
						svyset _n [pw=weight_adult], poststrata(old_strata_reg_sex2) postweight(old_reg_sex_share2)

						forvalue i=1/6{
						qui svy:mean mi03 if old_reg_group==`i'
						local y`i'=_b[mi03]
						local y_se`i'=_se[mi03]
						}
						
						forvalue i=1/3{
						local k=`i'+6
						svy:mean mi03 if location2==`i' 
						local y`k'=_b[mi03]
						local y_se`k'=_se[mi03]
						}

					clear
					set obs 5
					
					forvalue i=1/9{
					gen var`i'=.
					replace var`i'=`x`i'' if _n==3
					replace var`i'=`x_se`i'' if _n==4
					replace var`i'=`y`i'' if _n==1
					replace var`i'=`y_se`i'' if _n==2
					replace var`i'=`sh`i'' if _n==5
					}
					
					
					gen var=""
					replace var="Move from" if _n==1
					replace var="Move to" if _n==3
					replace var="Share" if _n==5
					
					forvalue i=1/9{
					tostring var`i', replace force
					replace var`i'=substr(var`i',1,4)
				}
				
				foreach v of varlist var1-var10{
					replace `v'="("+`v'+")" if _n==2 | _n==4
				}

				order var
					
								texsave v* using "$root\tex\migration2.tex", nonames replace frag  headerlines("& Dakar & Casamance & Diourbel & North & South-East & Centre & Thiès & Reg. Capital & Other town & Village") nofix landscape title ("Migration by region") footlines("") footnote ("Regions are grouped because of small sample sizes. Casamance: Ziguinchor/Kolda/Sedhiou. North: Louga/Saint-Louis/Matam. South-East: Tambacounda/Kédougou. Centre: Fatick/Kaolack/Kaffrine.")	
					
			
			
			*** Awarness and perception AT01, AT02, AT03, GS05
			use "$root/dat/SN_2020_Covid19.dta", clear
			drop if consent==0
			drop if pilot==1

			* svyset declares the post-stratifcation design using true regional weight as share. 
				svyset _n [pw=weight_adult], poststrata(mi01) postweight(region_share)
				
			*** Share of population (\%)
			tab location, gen(loc)
			tab educ, gen(ed)
			
			local sh1=100
			svy: mean ls02
			local sh2=_b[ls02]*100
			local sh3=100-`sh2'
			svy: mean dakar
			local sh4=_b[dakar]*100
			local sh5=100-`sh4'
			svy: mean loc1
			local sh6=_b[loc1]*100
			svy: mean loc2
			local sh7=_b[loc2]*100
			svy: mean loc3
			local sh8=_b[loc3]*100
			svy: mean ed1
			local sh9=_b[ed1]*100
			svy: mean ed2
			local sh10=_b[ed2]*100
			svy: mean ed3
			local sh11=_b[ed3]*100
			svy: mean pov_1_90
			local sh12=_b[pov_1_90]*100
			local sh13=100-`sh12'
			
			tab at03, gen(at03_)
			tab gs05, gen(at04_)
			
			foreach v of var at02 at03{
			rename `v' `v'_a
			}
		
			local k=2
			foreach v of var at02_1 at02_2 at02_3 at02_4 at02_5 at03_1 at03_2 at03_3 at03_4 at04_1 at04_2 at04_3{
			rename `v' at0`k'
			local k=`k'+1
				}
			
		
					forvalue i=1/13 {
					replace at0`i'=at0`i'*100
					}
				
				*National
				forvalue i=1/13 {
				qui svy: mean at0`i'
				local x1_at`i'=_b[at0`i']
				local se1_at`i'=_se[at0`i']
				}
				
				*Gender
				forvalue i=1/13 {
				qui svy: mean at0`i' if ls02==1
				local x2_at`i'=_b[at0`i']
				local se2_at`i'=_se[at0`i']
				}
				
				forvalue i=1/13 {
				qui svy: mean at0`i' if ls02==0
				local x3_at`i'=_b[at0`i']
				local se3_at`i'=_se[at0`i']
				}
				
				*Dakar
				forvalue i=1/13 {
				qui svy: mean at0`i' if dakar==1
				local x4_at`i'=_b[at0`i']
				local se4_at`i'=_se[at0`i']
				}
				
				forvalue i=1/13 {
				qui svy: mean at0`i' if dakar==0
				local x5_at`i'=_b[at0`i']
				local se5_at`i'=_se[at0`i']
				}
				
				*Location
				forvalue i=1/13 {
				qui svy: mean at0`i' if location==1
				local x6_at`i'=_b[at0`i']
				local se6_at`i'=_se[at0`i']
				}
				
				forvalue i=1/13 {
				qui svy: mean at0`i' if location==2
				local x7_at`i'=_b[at0`i']
				local se7_at`i'=_se[at0`i']
				}
				
				forvalue i=1/13 {
				qui svy: mean at0`i' if location==3
				local x8_at`i'=_b[at0`i']
				local se8_at`i'=_se[at0`i']
				}
				
				*Education
				forvalue i=1/13 {
				qui svy: mean at0`i' if educ==1
				local x9_at`i'=_b[at0`i']
				local se9_at`i'=_se[at0`i']
				}
				
				forvalue i=1/13 {
				qui svy: mean at0`i' if educ==2
				local x10_at`i'=_b[at0`i']
				local se10_at`i'=_se[at0`i']
				}
				
				forvalue i=1/13 {
				qui svy: mean at0`i' if educ==3
				local x11_at`i'=_b[at0`i']
				local se11_at`i'=_se[at0`i']
				}
				
				*Poverty
				forvalue i=1/13 {
				qui svy: mean at0`i' if pov_1_90==1
				local x12_at`i'=_b[at0`i']
				local se12_at`i'=_se[at0`i']
				}
				
				forvalue i=1/13 {
				qui svy: mean at0`i' if pov_1_90==0
				local x13_at`i'=_b[at0`i']
				local se13_at`i'=_se[at0`i']
				}
				

				clear
				set obs 13
				forvalue i=1/29{
				gen var`i'=""
				}
				
					forvalue j=1/13 {
				local k=1
				forvalue i=1(2)25{
				replace var`i' = "`x`j'_at`k''" if _n==`j'
				local k=`k'+1
					}
				}
				
					forvalue j=1/13 {
				local k=1
				forvalue i=2(2)26{
				replace var`i' = "`se`j'_at`k''" if _n==`j'
				local k=`k'+1
					}
				}
			
				gen var=""
				gen var_blank=""
				gen var_blankk=""
				order var, after(var2)
				order var_blank, after(var12)
				order var_blankk, after(var20)
			
				sxpose, clear
								
				local k=1
				forvalue i=1/13{
				replace _var`i' = "`sh`k''" if _n==31
				local k=`k'+1			
				}
				
				gen var=""
				replace var= "Before this call, \\ had you heard about covid-19? " if _n==1
				replace var= "Where do you get information \\ on Coronavirus from?" if _n==3
				replace var=" \hspace{0.5cm} Government communication"  if _n==4
				replace var=" \hspace{0.5cm} Newspaper, TV or radio"  if _n==6
				replace var=" \hspace{0.5cm} Social media"  if _n==8
				replace var=" \hspace{0.5cm} Family or neighbour"  if _n==10
				replace var=" \hspace{0.5cm} Religious leader"  if _n==12
				replace var="How worried are you about \\ being infected with Coronavirus?"  if _n==14
				replace var=" \hspace{0.5cm} Not worried at all"  if _n==15
				replace var=" \hspace{0.5cm} A little bit worried"  if _n==17
				replace var=" \hspace{0.5cm} Worried"  if _n==19
				replace var=" \hspace{0.5cm} Extremely worried"  if _n==21
				replace var="What is your main source of \\ concern related to the Coronavirus crisis?"  if _n==23
				replace var=" \hspace{0.5cm} My health and that of my loved ones"  if _n==24
				replace var=" \hspace{0.5cm} Lack of money or food"  if _n==26
				replace var=" \hspace{0.5cm} I'm not worried"  if _n==28

				replace var= "Share of population (\%)" if _n==31			

				order var
				ren _var* var*
				
				forvalue i=1/13{
					replace var`i'=substr(var`i',1,4)
				}
				
				foreach v of varlist var1-var13{
				replace `v'="("+`v'+")" if _n==2
				}
				
				
				foreach v of varlist var1-var13{
				forvalue j=5(2)13 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
				foreach v of varlist var1-var13{
				forvalue j=16(2)22 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
				foreach v of varlist var1-var13{
				forvalue j=25(2)29 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
				foreach v of varlist var1-var13{
				replace `v'="100" if `v'=="100."
				}
				
				
				texsave v* using "$root\tex\awareness.tex", nonames replace frag  headerlines("& Nati-onal & Female & Male & ~~Dakar & ROS & Reg. capital & Other town & Village & No education & Prim-ary & Secon-dary+ & Poor & Not poor") nofix landscape title ("Awarness and perceptions") footlines("") footnote ("Standard errors in parentheses.")
			
			
			*/** Gvt policies GS01, GS02, GS03 & GS04
						use "$root/dat/SN_2020_Covid19.dta", clear
			drop if consent==0
			drop if pilot==1

			* svyset declares the post-stratifcation design using true regional weight as share. 
				svyset _n [pw=weight_adult], poststrata(mi01) postweight(region_share)
				
			*** Share of population (\%)
			tab location, gen(loc)
			tab educ, gen(ed)
			
			local sh1=100
			svy: mean ls02
			local sh2=_b[ls02]*100
			local sh3=100-`sh2'
			svy: mean dakar
			local sh4=_b[dakar]*100
			local sh5=100-`sh4'
			svy: mean loc1
			local sh6=_b[loc1]*100
			svy: mean loc2
			local sh7=_b[loc2]*100
			svy: mean loc3
			local sh8=_b[loc3]*100
			svy: mean ed1
			local sh9=_b[ed1]*100
			svy: mean ed2
			local sh10=_b[ed2]*100
			svy: mean ed3
			local sh11=_b[ed3]*100
			svy: mean pov_1_90
			local sh12=_b[pov_1_90]*100
			local sh13=100-`sh12'
			
			replace gs04=0 if gs04==2
			tab gs01, gen(gs01_)
			tab gs02, gen(gs02_)
			tab gs03, gen(gs03_)
			
			foreach v of var gs01 gs02 gs03 gs05{
			rename `v' `v'_a
			}
			
			rename gs04 gs016
			local k=1
			foreach v of var gs01_1 gs01_2 gs01_3 gs01_4 gs01_5 gs02_1 gs02_2 gs02_3 gs02_4 gs02_5 gs03_1 gs03_2 gs03_3 gs03_4 gs03_5 {
			rename `v' gs0`k'
			local k=`k'+1
				}
			
		
					forvalue i=1/16 {
					replace gs0`i'=gs0`i'*100
					}
				
				*National
				forvalue i=1/16 {
				qui svy: mean gs0`i'
				local x1_gs`i'=_b[gs0`i']
				local se1_gs`i'=_se[gs0`i']
				}
				
				*Gender
				forvalue i=1/16 {
				qui svy: mean gs0`i' if ls02==1
				local x2_gs`i'=_b[gs0`i']
				local se2_gs`i'=_se[gs0`i']
				}
				
				forvalue i=1/16 {
				qui svy: mean gs0`i' if ls02==0
				local x3_gs`i'=_b[gs0`i']
				local se3_gs`i'=_se[gs0`i']
				}
				
				*Dakar
				forvalue i=1/16 {
				qui svy: mean gs0`i' if dakar==1
				local x4_gs`i'=_b[gs0`i']
				local se4_gs`i'=_se[gs0`i']
				}
				
				forvalue i=1/16{
				qui svy: mean gs0`i' if dakar==0
				local x5_gs`i'=_b[gs0`i']
				local se5_gs`i'=_se[gs0`i']
				}
				
				*Location
				forvalue i=1/16 {
				qui svy: mean gs0`i' if location==1
				local x6_gs`i'=_b[gs0`i']
				local se6_gs`i'=_se[gs0`i']
				}
				
				forvalue i=1/16 {
				qui svy: mean gs0`i' if location==2
				local x7_gs`i'=_b[gs0`i']
				local se7_gs`i'=_se[gs0`i']
				}
				
				forvalue i=1/16 {
				qui svy: mean gs0`i' if location==3
				local x8_gs`i'=_b[gs0`i']
				local se8_gs`i'=_se[gs0`i']
				}
				
				*Education
				forvalue i=1/16 {
				qui svy: mean gs0`i' if educ==1
				local x9_gs`i'=_b[gs0`i']
				local se9_gs`i'=_se[gs0`i']
				}
				
				forvalue i=1/16 {
				qui svy: mean gs0`i' if educ==2
				local x10_gs`i'=_b[gs0`i']
				local se10_gs`i'=_se[gs0`i']
				}
				
				forvalue i=1/16 {
				qui svy: mean gs0`i' if educ==3
				local x11_gs`i'=_b[gs0`i']
				local se11_gs`i'=_se[gs0`i']
				}
				
				*Poverty
				forvalue i=1/16{
				qui svy: mean gs0`i' if pov_1_90==1
				local x12_gs`i'=_b[gs0`i']
				local se12_gs`i'=_se[gs0`i']
				}
				
				forvalue i=1/16 {
				qui svy: mean gs0`i' if pov_1_90==0
				local x13_gs`i'=_b[gs0`i']
				local se13_gs`i'=_se[gs0`i']
				}
				

				clear
				set obs 13
				forvalue i=1/35{
				gen var`i'=""
				}
				
					forvalue j=1/13 {
				local k=1
				forvalue i=1(2)31{
				replace var`i' = "`x`j'_gs`k''" if _n==`j'
				local k=`k'+1
					}
				}
				
					forvalue j=1/13 {
				local k=1
				forvalue i=2(2)32{
				replace var`i' = "`se`j'_gs`k''" if _n==`j'
				local k=`k'+1
					}
				}
			
				gen var=""
				gen var_blank=""
				gen var_blankk=""

				order var, before(var1)
				order var_blank, after(var10)
				order var_blankk, after(var20)
			
				sxpose, clear
								
				local k=1
				forvalue i=1/13{
				replace _var`i' = "`sh`k''" if _n==37
				local k=`k'+1			
				}
				
				gen var=""
				replace var= "Do you think the reaction of your \\country’s government to the current \\coronavirus outbreak is ...?" if _n==1
				replace var=" \hspace{0.5cm} Too extreme"  if _n==2
				replace var=" \hspace{0.5cm} Somewhat too extreme"  if _n==4
				replace var=" \hspace{0.5cm} Appropriate"  if _n==6
				replace var=" \hspace{0.5cm} Somewhat insufficient"  if _n==8
				replace var=" \hspace{0.5cm} Insufficient"  if _n==10
				replace var="How much do you trust your country’s \\ government to take care of its citizens? "  if _n==12
				replace var=" \hspace{0.5cm} Strongly distrust"  if _n==13
				replace var=" \hspace{0.5cm} Somewhat distrust"  if _n==15
				replace var=" \hspace{0.5cm} Neither trust nor distrust"  if _n==17
				replace var=" \hspace{0.5cm} Somewhat trust"  if _n==19
				replace var=" \hspace{0.5cm} Strongly trust"  if _n==21
				replace var="How factually truthful do you think \\ your country’s government has been about \\ the coronavirus outbreak? "  if _n==23
				replace var=" \hspace{0.5cm} Very untruthful"  if _n==24
				replace var=" \hspace{0.5cm} Somewhat untruthful"  if _n==26
				replace var=" \hspace{0.5cm} Neither truthful nor untruthful"  if _n==28
				replace var=" \hspace{0.5cm} Somewhat truthfull"  if _n==30
				replace var=" \hspace{0.5cm} Very truthful"  if _n==32
				replace var="Are you in favor of a lock-down,\\ for 2 weeks to fight against the spread \\ of the Coronavirus?"  if _n==34
				replace var= "Share of population (\%)" if _n==37			

				order var
				ren _var* var*
				
				forvalue i=1/13{
					replace var`i'=substr(var`i',1,4)
				}
				
				foreach v of varlist var1-var13{
				forvalue j=3(2)11 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
				foreach v of varlist var1-var13{
				forvalue j=14(2)22 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
				foreach v of varlist var1-var13{
				forvalue j=25(2)35 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
				 snapshot save, label("before changes")
				 drop if _n>22 & _n<36
				
				texsave v* using "$root\tex\government1.tex", nonames replace frag  headerlines("& Nati-onal & Female & Male & ~~Dakar & ROS & Reg. capital & Other town & Village & No education & Prim-ary & Secon-dary+ & Poor & Not poor") nofix landscape title ("Government policies") footlines("")
				
				snapshot restore 1
				keep if _n>22

				texsave v* using "$root\tex\government2.tex", nonames replace frag  headerlines("& Nati-onal & Female & Male & ~~Dakar & ROS & Reg. capital & Other town & Village & No education & Prim-ary & Secon-dary+ & Poor & Not poor") nofix landscape title ("Government policies") footlines("")
				*/
				
				*** Gvt policies GS02, GS03 & GS04
			use "$root/dat/SN_2020_Covid19.dta", clear
			drop if consent==0
			drop if pilot==1

			* svyset declares the post-stratifcation design using true regional weight as share. 
				svyset _n [pw=weight_adult], poststrata(strata_reg_sex2) postweight(reg_sex_share2)
				
			*** Share of population
			tab location, gen(loc)
			tab educ, gen(ed)
			
			local sh1=100
			svy: mean ls02
			local sh2=_b[ls02]*100
			local sh3=100-`sh2'
			svy: mean dakar
			local sh4=_b[dakar]*100
			local sh5=100-`sh4'
			svy: mean loc1
			local sh6=_b[loc1]*100
			svy: mean loc2
			local sh7=_b[loc2]*100
			svy: mean loc3
			local sh8=_b[loc3]*100
			svy: mean ed1
			local sh9=_b[ed1]*100
			svy: mean ed2
			local sh10=_b[ed2]*100
			svy: mean ed3
			local sh11=_b[ed3]*100
			svy: mean pov_1_90
			local sh12=_b[pov_1_90]*100
			local sh13=100-`sh12'
			
			replace gs04=0 if gs04==2
			tab gs01, gen(gs01_)
			tab gs02, gen(gs02_)
			tab gs03, gen(gs03_)
			
			foreach v of var gs01 gs02 gs03 gs05{
			rename `v' `v'_a
			}
			
			rename gs04 gs016
			local k=1
			foreach v of var gs01_1 gs01_2 gs01_3 gs01_4 gs01_5 gs02_1 gs02_2 gs02_3 gs02_4 gs02_5 gs03_1 gs03_2 gs03_3 gs03_4 gs03_5 {
			rename `v' gs0`k'
			local k=`k'+1
				}
			
		
					forvalue i=6/16 {
					replace gs0`i'=gs0`i'*100
					}
				
				*National
				forvalue i=6/16 {
				qui svy: mean gs0`i'
				local x1_gs`i'=_b[gs0`i']
				local se1_gs`i'=_se[gs0`i']
				}
				
				*Gender
				forvalue i=6/16 {
				qui svy: mean gs0`i' if ls02==1
				local x2_gs`i'=_b[gs0`i']
				local se2_gs`i'=_se[gs0`i']
				}
				
				forvalue i=6/16 {
				qui svy: mean gs0`i' if ls02==0
				local x3_gs`i'=_b[gs0`i']
				local se3_gs`i'=_se[gs0`i']
				}
				
				*Dakar
				forvalue i=6/16 {
				qui svy: mean gs0`i' if dakar==1
				local x4_gs`i'=_b[gs0`i']
				local se4_gs`i'=_se[gs0`i']
				}
				
				forvalue i=6/16{
				qui svy: mean gs0`i' if dakar==0
				local x5_gs`i'=_b[gs0`i']
				local se5_gs`i'=_se[gs0`i']
				}
				
				*Location
				forvalue i=6/16 {
				qui svy: mean gs0`i' if location==1
				local x6_gs`i'=_b[gs0`i']
				local se6_gs`i'=_se[gs0`i']
				}
				
				forvalue i=6/16 {
				qui svy: mean gs0`i' if location==2
				local x7_gs`i'=_b[gs0`i']
				local se7_gs`i'=_se[gs0`i']
				}
				
				forvalue i=6/16 {
				qui svy: mean gs0`i' if location==3
				local x8_gs`i'=_b[gs0`i']
				local se8_gs`i'=_se[gs0`i']
				}
				
				*Education
				forvalue i=6/16 {
				qui svy: mean gs0`i' if educ==1
				local x9_gs`i'=_b[gs0`i']
				local se9_gs`i'=_se[gs0`i']
				}
				
				forvalue i=6/16 {
				qui svy: mean gs0`i' if educ==2
				local x10_gs`i'=_b[gs0`i']
				local se10_gs`i'=_se[gs0`i']
				}
				
				forvalue i=6/16 {
				qui svy: mean gs0`i' if educ==3
				local x11_gs`i'=_b[gs0`i']
				local se11_gs`i'=_se[gs0`i']
				}
				
				*Poverty
				forvalue i=6/16{
				qui svy: mean gs0`i' if pov_1_90==1
				local x12_gs`i'=_b[gs0`i']
				local se12_gs`i'=_se[gs0`i']
				}
				
				forvalue i=6/16 {
				qui svy: mean gs0`i' if pov_1_90==0
				local x13_gs`i'=_b[gs0`i']
				local se13_gs`i'=_se[gs0`i']
				}
				

				clear
				set obs 13
				forvalue i=1/26{
				gen var`i'=""
				}
				
					forvalue j=1/13 {
				local k=6
				forvalue i=1(2)25{
				replace var`i' = "`x`j'_gs`k''" if _n==`j'
				local k=`k'+1
					}
				}
				
					forvalue j=1/13 {
				local k=6
				forvalue i=2(2)26{
				replace var`i' = "`se`j'_gs`k''" if _n==`j'
				local k=`k'+1
					}
				}
			
				gen var=""
				gen var_blank=""
				gen var_blankk=""

				order var, before(var1)
				order var_blank, after(var10)
				order var_blankk, after(var22)
			
				sxpose, clear
								
				local k=1
				forvalue i=1/13{
				replace _var`i' = "`sh`k''" if _n==26
				local k=`k'+1			
				}
				
				gen var=""
				replace var="How much do you trust your country’s \\ government to take care of its citizens? "  if _n==1
				replace var=" \hspace{0.5cm} Strongly distrust" if _n==2
				replace var=" \hspace{0.5cm} Somewhat distrust"  if _n==4
				replace var=" \hspace{0.5cm} Neither trust nor distrust" if _n==6
				replace var=" \hspace{0.5cm} Somewhat trust"  if _n==8
				replace var=" \hspace{0.5cm} Strongly trust"   if _n==10
				replace var="How factually truthful do you think \\ your country’s government has been about \\ the coronavirus outbreak? " if _n==12
				replace var=" \hspace{0.5cm} Very untruthful"   if _n==13
				replace var=" \hspace{0.5cm} Somewhat untruthful" if _n==15
				replace var=" \hspace{0.5cm} Neither truthful nor untruthful"  if _n==17
				replace var=" \hspace{0.5cm} Somewhat truthful"  if _n==19
				replace var=" \hspace{0.5cm} Very truthful" if _n==21
				replace var="Are you in favor of a lock-down,\\ for 2 weeks to fight against the spread \\ of the Coronavirus?"  if _n==23
				replace var= "Share of population (\%)" if _n==26		

				order var
				ren _var* var*
				
				forvalue i=1/13{
					replace var`i'=substr(var`i',1,4)
				}
				
				foreach v of varlist var1-var13{
				forvalue j=3(2)11 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
				foreach v of varlist var1-var13{
				forvalue j=14(2)22 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
				foreach v of varlist var1-var13{
					replace `v'="("+`v'+")" if _n==24
					
				}
							
				texsave v* using "$root\tex\government1.tex", nonames replace frag  headerlines("& Nati-onal & Female & Male & ~~Dakar & ROS & Reg. capital & Other town & Village & No education & Prim-ary & Secon-dary+ & Poor & Not poor") nofix landscape title ("Government policies") footlines("") footnote ("Standard errors in parentheses.")
				
				
*** Symptoms
			use "$root/dat/SN_2020_Covid19.dta", clear
			drop if consent==0
			drop if pilot==1

			* svyset declares the post-stratifcation design using true regional weight as share. 
				svyset _n [pw=weight_adult], poststrata(mi01) postweight(region_share)
				
			*** Share of population (\%)
			tab location, gen(loc)
			tab educ, gen(ed)
			
			local sh1=100
			svy: mean ls02
			local sh2=_b[ls02]*100
			local sh3=100-`sh2'
			svy: mean dakar
			local sh4=_b[dakar]*100
			local sh5=100-`sh4'
			svy: mean loc1
			local sh6=_b[loc1]*100
			svy: mean loc2
			local sh7=_b[loc2]*100
			svy: mean loc3
			local sh8=_b[loc3]*100
			svy: mean ed1
			local sh9=_b[ed1]*100
			svy: mean ed2
			local sh10=_b[ed2]*100
			svy: mean ed3
			local sh11=_b[ed3]*100
			svy: mean pov_1_90
			local sh12=_b[pov_1_90]*100
			local sh13=100-`sh12'
		
					forvalue i=1/3 {
					replace sm0`i'=sm0`i'*100
					}
				
				*National
				forvalue i=1/3 {
				qui svy: mean sm0`i'
				local x1_sm`i'=_b[sm0`i']
				local se1_sm`i'=_se[sm0`i']
				}
				
				*Gender
				forvalue i=1/3 {
				qui svy: mean sm0`i' if ls02==1
				local x2_sm`i'=_b[sm0`i']
				local se2_sm`i'=_se[sm0`i']
				}
				
				forvalue i=1/3 {
				qui svy: mean sm0`i' if ls02==0
				local x3_sm`i'=_b[sm0`i']
				local se3_sm`i'=_se[sm0`i']
				}
				
				*Dakar
				forvalue i=1/3 {
				qui svy: mean sm0`i' if dakar==1
				local x4_sm`i'=_b[sm0`i']
				local se4_sm`i'=_se[sm0`i']
				}
				
				forvalue i=1/3 {
				qui svy: mean sm0`i' if dakar==0
				local x5_sm`i'=_b[sm0`i']
				local se5_sm`i'=_se[sm0`i']
				}
				
				*Location
				forvalue i=1/3 {
				qui svy: mean sm0`i' if location==1
				local x6_sm`i'=_b[sm0`i']
				local se6_sm`i'=_se[sm0`i']
				}
				
				forvalue i=1/3 {
				qui svy: mean sm0`i' if location==2
				local x7_sm`i'=_b[sm0`i']
				local se7_sm`i'=_se[sm0`i']
				}
				
				forvalue i=1/3 {
				qui svy: mean sm0`i' if location==3
				local x8_sm`i'=_b[sm0`i']
				local se8_sm`i'=_se[sm0`i']
				}
				
				*Education
				forvalue i=1/3 {
				qui svy: mean sm0`i' if educ==1
				local x9_sm`i'=_b[sm0`i']
				local se9_sm`i'=_se[sm0`i']
				}
				
				forvalue i=1/3 {
				qui svy: mean sm0`i' if educ==2
				local x10_sm`i'=_b[sm0`i']
				local se10_sm`i'=_se[sm0`i']
				}
				
				forvalue i=1/3 {
				qui svy: mean sm0`i' if educ==3
				local x11_sm`i'=_b[sm0`i']
				local se11_sm`i'=_se[sm0`i']
				}
				
				*Poverty
				forvalue i=1/3 {
				qui svy: mean sm0`i' if pov_1_90==1
				local x12_sm`i'=_b[sm0`i']
				local se12_sm`i'=_se[sm0`i']
				}
				
				forvalue i=1/3 {
				qui svy: mean sm0`i' if pov_1_90==0
				local x13_sm`i'=_b[sm0`i']
				local se13_sm`i'=_se[sm0`i']
				}
				

				clear
				set obs 13
				forvalue i=1/9{
				gen var`i'=""
				}
				
					forvalue j=1/13 {
				local k=1
				forvalue i=1(2)5{
				replace var`i' = "`x`j'_sm`k''" if _n==`j'
				local k=`k'+1
					}
				}
				
					forvalue j=1/13 {
				local k=1
				forvalue i=2(2)6{
				replace var`i' = "`se`j'_sm`k''" if _n==`j'
				local k=`k'+1
					}
				}
			
				sxpose, clear
								
				local k=1
				forvalue i=1/13{
				replace _var`i' = "`sh`k''" if _n==8
				local k=`k'+1			
				}
				
				gen var=""
				replace var= "In the last two weeks, \\ have you experienced fever?" if _n==1
				replace var= "In the last two weeks, \\ have you experienced a dry cough?" if _n==3
				replace var="In the last two weeks, \\have you experienced difficulty \\ breathing / shortness of breath?"  if _n==5
				replace var= "Share of population (\%)" if _n==8				

				order var
				ren _var* var*
				
				forvalue i=1/13{
					replace var`i'=substr(var`i',1,4)
				}
				
				foreach v of varlist var1-var13{
				forvalue j=2(2)26 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
				texsave v* using "$root\tex\symptoms.tex", nonames replace frag  headerlines("& Nati-onal & Female & Male & ~~Dakar & ROS & Reg. capital & Other town & Village & No education & Prim-ary & Secon-dary+ & Poor & Not poor") nofix landscape title ("Symptoms") footlines("") footnote ("Standard errors in parentheses.")
				
				
			*** Education of children ED06
			use "$root/dat/SN_2020_Covid19.dta", clear
			drop if consent==0
			drop if pilot==1
			
			* svyset declares the post-stratifcation design using true regional weight as share. 
				svyset _n [pw=weight_child], poststrata(mi01) postweight(region_share)
				

			*** Share of population
			tab location, gen(loc)
			tab educ, gen(ed)
			
			local sh1=100
			svy: mean dakar
			local sh2=_b[dakar]*100
			local sh3=100-`sh2'
			svy: mean loc1
			local sh4=_b[loc1]*100
			svy: mean loc2
			local sh5=_b[loc2]*100
			svy: mean loc3
			local sh6=_b[loc3]*100
			svy: mean ed1
			local sh7=_b[ed1]*100
			svy: mean ed2
			local sh8=_b[ed2]*100
			svy: mean ed3
			local sh9=_b[ed3]*100
			svy: mean pov_1_90
			local sh10=_b[pov_1_90]*100
			local sh11=100-`sh10'
			
			gen ed08=(ed06=="2" | ed06=="2 -7" | ed06=="1" & ed06!="")

			drop ed06__7
			drop ed01-ed06
		
		
			local k=1
			foreach v of var ed06_1 ed06_2 ed06_3 ed06_4 ed06_5 ed06_6 ed06_7{
			rename `v' ed0`k'
			local k=`k'+1
				}
					forvalue i=1/8 {
					replace ed0`i'=ed0`i'*100
					}
				
				*National
				forvalue i=1/8 {
				qui svy: mean ed0`i'
				local x1_ed`i'=_b[ed0`i']
				local se1_ed`i'=_se[ed0`i']
				}
								
				*Dakar
				forvalue i=1/8 {
				qui svy: mean ed0`i' if dakar==1
				local x2_ed`i'=_b[ed0`i']
				local se2_ed`i'=_se[ed0`i']
				}
				
				forvalue i=1/8 {
				qui svy: mean ed0`i' if dakar==0
				local x3_ed`i'=_b[ed0`i']
				local se3_ed`i'=_se[ed0`i']
				}
				
				*Location
				forvalue i=1/8 {
				qui svy: mean ed0`i' if location==1
				local x4_ed`i'=_b[ed0`i']
				local se4_ed`i'=_se[ed0`i']
				}
				
				forvalue i=1/8 {
				qui svy: mean ed0`i' if location==2
				local x5_ed`i'=_b[ed0`i']
				local se5_ed`i'=_se[ed0`i']
				}
				
				forvalue i=1/8 {
				qui svy: mean ed0`i' if location==3
				local x6_ed`i'=_b[ed0`i']
				local se6_ed`i'=_se[ed0`i']
				}
				
				*Education
				forvalue i=1/8 {
				qui svy: mean ed0`i' if educ==1
				local x7_ed`i'=_b[ed0`i']
				local se7_ed`i'=_se[ed0`i']
				}
				
				forvalue i=1/8 {
				qui svy: mean ed0`i' if educ==2
				local x8_ed`i'=_b[ed0`i']
				local se8_ed`i'=_se[ed0`i']
				}
				
				forvalue i=1/8 {
				qui svy: mean ed0`i' if educ==3
				local x9_ed`i'=_b[ed0`i']
				local se9_ed`i'=_se[ed0`i']
				}
				
				*Poverty
				forvalue i=1/8 {
				qui svy: mean ed0`i' if pov_1_90==1
				local x10_ed`i'=_b[ed0`i']
				local se10_ed`i'=_se[ed0`i']
				}
				
				forvalue i=1/8 {
				qui svy: mean ed0`i' if pov_1_90==0
				local x11_ed`i'=_b[ed0`i']
				local se11_ed`i'=_se[ed0`i']
				}
				
				clear
				set obs 11
				forvalue i=1/17{
				gen var`i'=""
				}
				
				forvalue j=1/11 {
				local k=1
				forvalue i=1(2)15{
				replace var`i' = "`x`j'_ed`k''" if _n==`j'
				local k=`k'+1
					}
				}
				
				forvalue j=1/11 {
				local k=1
				forvalue i=2(2)16{
				replace var`i' = "`se`j'_ed`k''" if _n==`j'
				local k=`k'+1
					}
				}
			
				gen var=""
				order var
			
				sxpose, clear
								
				local k=1
				forvalue i=1/11{
				replace _var`i' = "`sh`k''" if _n==18
				local k=`k'+1			
				}
				
				gen var=""
				replace var="What educational activities have children \\ been pursuing since the schools were closed?"  if _n==1
				replace var=" \hspace{0.5cm} None"  if _n==2
				replace var=" \hspace{0.5cm} Study alone"  if _n==4
				replace var=" \hspace{0.5cm} Exercise given by parents"  if _n==6
				replace var=" \hspace{0.5cm} Exercise given by teachers"  if _n==8
				replace var=" \hspace{0.5cm} Education shows on tv and radio"  if _n==10
				replace var=" \hspace{0.5cm} Online courses"  if _n==12
				replace var=" \hspace{0.5cm} Private teacher"  if _n==14
				replace var=" \hspace{0.5cm} No learning or study alone"  if _n==16
				replace var= "Share of population" if _n==18		
			

				order var
				ren _var* var*
				
				forvalue i=1/11{
					replace var`i'=substr(var`i',1,4)
				}
				
				
				foreach v of varlist var1-var11{
				forvalue j=3(2)17 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
								
				foreach v of varlist var1-var11{
				replace `v'="100" if `v'=="100."
				}
				
				texsave v* using "$root\tex\education.tex", nonames replace frag  headerlines("& Nati-onal & Dakar & ROS & Reg. capital & Other town & Village & No education & Prim-ary & Secon-dary+ & Poor & Not poor") nofix landscape title ("Education") footlines("") footnote ("Standard errors in parentheses.")
				
			*** Child time use ED07a, ED07b
						use "$root/dat/SN_2020_Covid19.dta", clear
			drop if consent==0
			drop if pilot==1
			
			* svyset declares the post-stratifcation design using true regional weight as share. 
				svyset _n [pw=weight_child], poststrata(mi01) postweight(region_share)
				
			*** Share of population (\%)
			tab location, gen(loc)
			tab educ, gen(ed)
			
			local sh1=100
			svy: mean dakar
			local sh2=_b[dakar]*100
			local sh3=100-`sh2'
			svy: mean loc1
			local sh4=_b[loc1]*100
			svy: mean loc2
			local sh5=_b[loc2]*100
			svy: mean loc3
			local sh6=_b[loc3]*100
			svy: mean ed1
			local sh7=_b[ed1]*100
			svy: mean ed2
			local sh8=_b[ed2]*100
			svy: mean ed3
			local sh9=_b[ed3]*100
			svy: mean pov_1_90
			local sh10=_b[pov_1_90]*100
			local sh11=100-`sh10'
			
			drop ed01-ed04 ed06*
			ren ed05 ed05a
			
			tab ed07a, gen(ed0)
			forvalue i=1/7{
			local k=`i'+7
			ren ed0`i' ed0`k'
			}
			
			tab ed05a if ed05a<8, gen(ed0)
	
		
				forvalue i=1/14 {
					replace ed0`i'=ed0`i'*100
					}
				
				*National
				forvalue i=1/14 {
				qui svy: mean ed0`i'
				local x1_ed`i'=_b[ed0`i']
				local se1_ed`i'=_se[ed0`i']
				}
						
				*Dakar
				forvalue i=1/14 {
				qui svy: mean ed0`i' if dakar==1
				local x2_ed`i'=_b[ed0`i']
				local se2_ed`i'=_se[ed0`i']
				}
				
				forvalue i=1/14 {
				qui svy: mean ed0`i' if dakar==0
				local x3_ed`i'=_b[ed0`i']
				local se3_ed`i'=_se[ed0`i']
				}
				
				*Location
				forvalue i=1/14 {
				qui svy: mean ed0`i' if location==1
				local x4_ed`i'=_b[ed0`i']
				local se4_ed`i'=_se[ed0`i']
				}
				
				forvalue i=1/14 {
				qui svy: mean ed0`i' if location==2
				local x5_ed`i'=_b[ed0`i']
				local se5_ed`i'=_se[ed0`i']
				}
				
				forvalue i=1/14 {
				qui svy: mean ed0`i' if location==3
				local x6_ed`i'=_b[ed0`i']
				local se6_ed`i'=_se[ed0`i']
				}
				
				*Education
				forvalue i=1/14 {
				qui svy: mean ed0`i' if educ==1
				local x7_ed`i'=_b[ed0`i']
				local se7_ed`i'=_se[ed0`i']
				}
				
				forvalue i=1/14 {
				qui svy: mean ed0`i' if educ==2
				local x8_ed`i'=_b[ed0`i']
				local se8_ed`i'=_se[ed0`i']
				}
				
				forvalue i=1/14 {
				qui svy: mean ed0`i' if educ==3
				local x9_ed`i'=_b[ed0`i']
				local se9_ed`i'=_se[ed0`i']
				}
				
				*Poverty
				forvalue i=1/14 {
				qui svy: mean ed0`i' if pov_1_90==1
				local x10_ed`i'=_b[ed0`i']
				local se10_ed`i'=_se[ed0`i']
				}
				
				forvalue i=1/14 {
				qui svy: mean ed0`i' if pov_1_90==0
				local x11_ed`i'=_b[ed0`i']
				local se11_ed`i'=_se[ed0`i']
				}
				
				clear
				set obs 11
				forvalue i=1/31{
				gen var`i'=""
				}
				
				forvalue j=1/11 {
				local k=1
				forvalue i=1(2)27{
				replace var`i' = "`x`j'_ed`k''" if _n==`j'
				local k=`k'+1
					}
				}
				
				forvalue j=1/11 {
				local k=1
				forvalue i=2(2)28{
				replace var`i' = "`se`j'_ed`k''" if _n==`j'
				local k=`k'+1
					}
				}
			
				gen var=""
				gen var_blank=""
				order var, before(var1)
				order var_blank, after(var14)
			
				sxpose, clear
								
				local k=1
				forvalue i=1/11{
				replace _var`i' = "`sh`k''" if _n==31
				local k=`k'+1			
				}
				
				gen var=""
				replace var= "While schools are closed, \\ who looks after the children?" if _n==1
				replace var=" \hspace{0.5cm} Me"  if _n==2
				replace var=" \hspace{0.5cm} Other parent"  if _n==4
				replace var=" \hspace{0.5cm} Grandparents"  if _n==6
				replace var=" \hspace{0.5cm} Extended family"  if _n==8
				replace var=" \hspace{0.5cm} Children look after themselves"  if _n==10
				replace var=" \hspace{0.5cm} Mother or father"  if _n==12
				replace var=" \hspace{0.5cm} Both parents"  if _n==14
				replace var= "Can you rank the 2 main activities \\ of children during the day? (1st)" if _n==16
				replace var=" \hspace{0.5cm} Stay at home to study"  if _n==17
				replace var=" \hspace{0.5cm} Stay at home to help"  if _n==19
				replace var=" \hspace{0.5cm} Stay at home to play "  if _n==21
				replace var=" \hspace{0.5cm} Play outside"  if _n==23
				replace var=" \hspace{0.5cm} Work outside"  if _n==25
				replace var=" \hspace{0.5cm} Stay at home to study Bible or Coran"  if _n==27
				replace var=" \hspace{0.5cm} Other"  if _n==29
				replace var= "Share of population (\%)" if _n==31		
			
				order var
				ren _var* var*
				
				forvalue i=1/11{
					replace var`i'=substr(var`i',1,4)
				}
					
				foreach v of varlist var1-var11{
				forvalue j=3(2)15 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
				foreach v of varlist var1-var11{
				forvalue j=18(2)30 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
				
				foreach v of varlist var1-var11{
				replace `v'="100" if `v'=="100."
				}
				
				
				texsave v* using "$root\tex\time_use.tex", nonames replace frag  headerlines("& Nati-onal & ~~Dakar & ROS & Reg. capital & Other town & Village & No education & Prim-ary & Secon-dary+ & Poor & Not poor") nofix landscape title ("Children care and children's time use") footlines("") footnote ("Standard errors in parentheses.")
			
